package com.xinan.system.meet;

import java.util.List;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

@TableBind(tableName = "tb_meet_article")
public class TbMeetArticle extends Model<TbMeetArticle>{
	
	private static final long serialVersionUID = 1L;
	
    public static final TbMeetArticle dao = new TbMeetArticle();

    //columns START
    private String ID = "id";  //主键
    private String MEETID = "meetid";  //会议主键
    private String TITLE = "title";  //软件题目
    private String CONTENT = "content";  //内容
    private String TRANSMITCOUNT = "transmitcount";  //转发量
    private String PUBLISHTIME = "publishtime";  //发布时间
    private String PUBLISHUSER = "publishuser";  //发布者
    private String CREATETIME = "createtime";  //创建时间
    private String CREATEID = "createid";  //创建者

    public void setId(int value) {
        set(ID, value);
    }

	public int getId() {
		return get(ID);
	}
    public void setMeetid(int value) {
        set(MEETID, value);
    }

	public int getMeetid() {
		return get(MEETID);
	}
    public void setTitle(String value) {
        set(TITLE, value);
    }

	public String getTitle() {
		return get(TITLE);
	}
    public void setContent(String value) {
        set(CONTENT, value);
    }

	public String getContent() {
		return get(CONTENT);
	}
    public void setTransmitcount(int value) {
        set(TRANSMITCOUNT, value);
    }

	public int getTransmitcount() {
		return get(TRANSMITCOUNT);
	}
    public void setPublishtime(String value) {
        set(PUBLISHTIME, value);
    }

	public String getPublishtime() {
		return get(PUBLISHTIME);
	}
    public void setPublishuser(int value) {
        set(PUBLISHUSER, value);
    }

	public int getPublishuser() {
		return get(PUBLISHUSER);
	}
    public void setCreatetime(String value) {
        set(CREATETIME, value);
    }

	public String getCreatetime() {
		return get(CREATETIME);
	}
    public void setCreateid(int value) {
        set(CREATEID, value);
    }

	public int getCreateid() {
		return get(CREATEID);
	}
	//columns END

    public List<TbMeetArticle> findAll() {
        return find("select * from tb_meet_article");
    }
    /**
     * @param   where
     * @return  Record
     */
    public List<Record> findAlls(String where) {
        String sqlExp = " from tb_meet_article";
        if(StrKit.notBlank(where)){
                sqlExp += " where " + where;
        }
                return Db.find( "select * " +sqlExp );

    }

    public Page<TbMeetArticle> page(int pageNumber, int pageSize, String where) {
        String sqlExp = "from tb_meet_article";
        if(StrKit.notBlank(where)){
            sqlExp += " where " + where;
        }
        return paginate(pageNumber, pageSize, "select *", sqlExp);
    }
    
    public Page<TbMeetArticle> query(int pageNumber, int pageSize, String where) {
        String sqlExp = " from ( select t.*,m.title as meettitle " //
        		+ " from tb_meet_article t left join tb_meet m on t.meetid=m.id ) t ";
        if(StrKit.notBlank(where)){
            sqlExp += " where " + where;
        }
        return paginate(pageNumber, pageSize, " select * ", sqlExp);
    }
}

